import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetBatchExport_ {
  /**
   * @description 指标id列表
   */
  ids?: number[];
}
export interface GetModelById_ {
  /**
   * @description 指标id
   */
  id: number;
}
export interface GetRelationById_ {
  /**
   * @description 指标id
   */
  id: number;
}

export class MetricsLibrary {
  /**
   * 指标库列表批量导出
   *
   * @tags 指标库controller
   * @request GET: /metrics/library/batch-export
   * @secure
   */
  getBatchExport = (query: { ids?: number[] } | GetBatchExport_, params: AxiosRequestConfig = {}) =>
    http.request<void>({
      url: `/metrics/library/batch-export`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 指标库指标详情页展示绑定模型
   *
   * @tags 指标库controller
   * @request GET: /metrics/library/model/{id}
   * @secure
   */
  getModelById = ({ id }: { id: number } | GetModelById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListBindModelVO>({
      url: `/metrics/library/model/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 指标库详情页展示关联指标
   *
   * @tags 指标库controller
   * @request GET: /metrics/library/relation/{id}
   * @secure
   */
  getRelationById = ({ id }: { id: number } | GetRelationById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityMetricsRelationGraphVO>({
      url: `/metrics/library/relation/${id}`,
      method: "GET",
      ...params,
    });
}

export default new MetricsLibrary();
